package com.wesley.spring.support.metadata;

import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.ClassMetadata;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;

import java.io.IOException;

/**
 * MetadataTest
 *
 * @author WangPanYong
 * @since 2024/01/12
 */
public class MetadataTest {
    public static void main(String[] args) throws IOException {
        SimpleMetadataReaderFactory factory = new SimpleMetadataReaderFactory();
        MetadataReader metadataReader = factory.getMetadataReader("com.wesley.spring.entity.Car");

        ClassMetadata classMetadata = metadataReader.getClassMetadata();
        System.out.println("classMetadata.getClassName() = " + classMetadata.getClassName());
        // 注解信息
        AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
        for (String annotationType : annotationMetadata.getAnnotationTypes()) {
            System.out.println("annotationType = " + annotationType);
        }
    }
}
